package tuling.EalyAopDemo.chaindemo;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.MethodBeforeAdvice;

public class MethodBeforeAdviceInterceptor implements MethodInterceptor {

	private MethodBeforeAdvice methodBeforeAdvice;

	public MethodBeforeAdviceInterceptor(MethodBeforeAdvice methodBeforeAdvice) {
		this.methodBeforeAdvice = methodBeforeAdvice;
	}

	@Override
	public Object invoke(MethodInvocation invocation) throws Throwable {
		methodBeforeAdvice.before(invocation.getMethod(),invocation.getArguments(),invocation.getThis());
		return invocation.proceed();
	}
}
